home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 3,701 to 3,800
/
aol-file-protocol-4400-3701-to-3800.zip
/
AOLDLs
/
Other Special Interests
/
OCCASION_ V1.3 Sp. Occasion F
/
FUNFAX.exe
/
HDAYFAX.EXE
/
REGIST.TXT
< prev
next >
Wrap
Text File
|
1995-07-03
|
4KB
|
171 lines
Function EnterRegist (UserName As String, RegistNum As String, RegistDate As String, Multiplier As Double) As Integer
'Retuns True if Name Matches Registration Number
'and writes data to Windows .ini file
Dim res As Integer
Dim NameLen As Integer
Dim x As Integer
Dim RegistName As String
Dim RegNamValue As Double
Dim RegNumValue As Double
Dim CurChar As String
Dim FaxSpeedStr As String
Dim OptionsStr As String
RegNamValue = 0
'Varify length
NameLen = Len(Trim$(UserName))
If NameLen < 14 Then
'Pad With Spaces
RegistName = Trim$(UserName)
For x = 1 To 14 - NameLen
RegistName = RegistName + " "
If Len(RegistName) = 14 Then
Exit For
End If
Next x
'This code adds 14 spaces to the end of the exsisting string it does not
'make sure the string length is only 14!
'RegistName = Trim$(UserName) + Space$(14)
Else
RegistName = Mid$(Trim$(UserName), 1, 14)
End If
'Calculate Ascii value
For x = 1 To 14
CurChar = Mid$(RegistName, x, 1)
RegNamValue = RegNamValue + Asc(CurChar)
Next x
'Grab the integer Part of ACSII Value
RegNamValue = Int(Multiplier * RegNamValue)
'Compare to Registration Number Entered
RegNumValue = Int(Val(Mid$(Trim$(RegistNum), 6, 5)))
'Compare two number to see if the data was entered correctly
If RegNumValue <> RegNamValue Then
'Return Error
EnterRegist = False
Exit Function
Else
'Create fax speed string
FaxSpeedStr = "max " + "/" + Mid$(Str$(RegNamValue), 5, 1) + " /" + Mid$(Str$(RegNamValue), 6, 1)
OptionsStr = "Set " + "/" + Mid$(Str$(RegNamValue), 2, 1) + " /" + Mid$(Str$(RegNamValue), 3, 1) + " /" + Mid$(Str$(RegNamValue), 4, 1)
'Write to Windows .ini file
res = StringToINI("Special Occation Fax", "User Name", UserName, "WIN.INI")
res = StringToINI("Special Occation Fax", "Fax speed", FaxSpeedStr, "WIN.INI")
res = StringToINI("Special Occation Fax", "Options", OptionsStr, "WIN.INI")
'res = StringToINI("Special Occation Fax", "Registration Date", RegistDate, "WIN.INI")
EnterRegist = True
End If
End Function
Function VarifyRegist (Multiplier As Double) As Integer
'Retuns True if Name Matches Registration Number
'and writes data to Windows .ini file
Dim res As Integer
Dim NameLen As Integer
Dim x As Integer
Dim RegistName As String
Dim RegNamValue As Double
Dim RegNumValue As Double
Dim CurChar As String
Dim UserName As String
Dim RegistNum As String
Dim RegistDate As String
Dim FaxSpeed As String
Dim Options As String
RegNamValue = 0
'Read Windows .INI file for Data
UserName = Trim$(StringFromINI("Special Occation Fax", "User Name", "", "WIN.INI"))
If UserName = "" Then
VarifyRegist = False
Exit Function
End If
FaxSpeed = StringFromINI("Special Occation Fax", "Fax Speed", "", "WIN.INI")
If FaxSpeed = "" Then
VarifyRegist = False
Exit Function
End If
Options = StringFromINI("Special Occation Fax", "Options", "", "WIN.INI")
If Options = "" Then
VarifyRegist = False
Exit Function
End If
'Varify
NameLen = Len(Trim$(UserName))
If NameLen < 14 Then
'Pad With Spaces
RegistName = Trim$(UserName)
For x = 1 To 14 - NameLen
RegistName = RegistName + " "
If Len(RegistName) = 14 Then
Exit For
End If
Next x
'RegistName = Trim$(UserName) + Space$(14)
Else
RegistName = Mid$(Trim$(UserName), 1, 14)
End If
'Calculate Ascii value
For x = 1 To 14
CurChar = Mid$(RegistName, x, 1)
RegNamValue = RegNamValue + Asc(CurChar)
Next x
'Grab the integer Part of ACSII Value
RegNamValue = Int(Multiplier * RegNamValue)
'Compare to Registration Number Entered
'RegNumValue = Int(Val(Mid$(Trim$(RegistNum), 6, 5)))
'Setup RegNameValue from Win.INI File
RegNumValue = Val(Mid$(Options, 6, 1) + Mid$(Options, 9, 1) + Mid$(Options, 12, 1) + Mid$(FaxSpeed, 6, 1) + Mid$(FaxSpeed, 9, 1))
'Compare two number to see if the data was entered correctly
If RegNumValue <> RegNamValue Then
'Return Error
VarifyRegist = False
Exit Function
Else
VarifyRegist = True
End If
End Function